
public class Vertex3D {
		double x, y, z;
		
		public Vertex3D(double x, double y, double z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}
		
		public Vertex3D(double x, double y) {
			this(x, y, 0);
		}
		
		public Vertex3D rotate(double xTheta, double yTheta, double zTheta) {
			return this.rotateAboutX(xTheta).rotateAboutY(yTheta).rotateAboutZ(zTheta);
		}
		
		public Vertex3D rotateAboutX(double theta) {
			double[][] rotationMatrix = {
					{1, 0, 0},
					{0, Math.cos(theta), -Math.sin(theta)},
					{0, Math.sin(theta), Math.cos(theta)}
			};
			
			return rotate(rotationMatrix);
		}
		
		public Vertex3D rotateAboutY(double theta) {
			double[][] rotationMatrix = {
					{Math.cos(theta), 0, Math.sin(theta)},
					{0, 1, 0},
					{-Math.sin(theta), 0, Math.cos(theta)}
			};
			
			return rotate(rotationMatrix);
		}
		
		public Vertex3D rotateAboutZ(double theta) {
			double[][] rotationMatrix = {
					{Math.cos(theta), -Math.sin(theta), 0},
					{Math.sin(theta), Math.cos(theta), 0},
					{0, 0, 1}
			};
			
			return rotate(rotationMatrix);
		}
		
		public Vertex3D rotate(double[][] rotationMatrix) {
			
			double[][] vertexMatrix = {
					{x},
					{y},
					{z}
			};
			
			double[][] rotated = Part1.multiply(rotationMatrix, vertexMatrix);
			
			return new Vertex3D(rotated[0][0], rotated[1][0], rotated[2][0]);
		}
		
		public double[][] getMatrix() {
			return new double[][] {
					{x},
					{y},
					{z}
			};
		}
	}
